/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.C150;
import queenb.web.util.PackageContants;

/**
 *
 * @author ems
 */
public class C150Store extends C150 {

    public List<C150> listC150All(int pnFH000, int pnFH200, int pnFC450, int pnFC500, String pvFC550, String pvCV154, Date pdCD153, int pnFB050, int pnREPART, String pvUSER, String pvSTATUS, int pnOFFSET, int pnLIMIT, int pnSORT, int pnDIRECTION, String pvLOGIN) throws SQLException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_C150, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFC450),
                    new Param(OracleTypes.INTEGER, pnFC500),
                    new Param(OracleTypes.CHAR, pvFC550),
                    new Param(OracleTypes.CHAR, pvCV154),
                    new Param(OracleTypes.DATE, pdCD153),
                    new Param(OracleTypes.INTEGER, pnFB050),
                    new Param(OracleTypes.INTEGER, pnREPART),
                    new Param(OracleTypes.CHAR, pvUSER),
                    new Param(OracleTypes.CHAR, pvSTATUS),
                    new Param(OracleTypes.INTEGER, pnOFFSET),
                    new Param(OracleTypes.INTEGER, pnLIMIT),
                    new Param(OracleTypes.INTEGER, pnSORT),
                    new Param(OracleTypes.INTEGER, pnDIRECTION),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.find(dataStatement, C150.class);
        } catch (InstantiationException ex) {
            Logger.getLogger(C150Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(C150Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    public List<C150> listC150CR(int pnFH000, int pnFH200, int pnFC450, int pnFC500, String pvFC550, String pvCV154, Date pdCD153, int pnFB050, int pnREPART, String pvUSER, String pvSTATUS, int pnOFFSET, int pnLIMIT, int pnSORT, int pnDIRECTION, String pvLOGIN) throws SQLException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_C150CR, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFC450),
                    new Param(OracleTypes.INTEGER, pnFC500),
                    new Param(OracleTypes.CHAR, pvFC550),
                    new Param(OracleTypes.CHAR, pvCV154),
                    new Param(OracleTypes.DATE, pdCD153),
                    new Param(OracleTypes.INTEGER, pnFB050),
                    new Param(OracleTypes.INTEGER, pnREPART),
                    new Param(OracleTypes.CHAR, pvUSER),
                    new Param(OracleTypes.CHAR, pvSTATUS),
                    new Param(OracleTypes.INTEGER, pnOFFSET),
                    new Param(OracleTypes.INTEGER, pnLIMIT),
                    new Param(OracleTypes.INTEGER, pnSORT),
                    new Param(OracleTypes.INTEGER, pnDIRECTION),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.find(dataStatement, C150.class);
        } catch (InstantiationException ex) {
            Logger.getLogger(C150Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(C150Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    //myhai them lst du an hoan thanhtheo ngay tuan thang

    public List<C150> listC150F(int pnFH000, int pnFH200, int pnFB050, String pvSTATUS, String pvUSER, int pnDAYS, int pnOFFSET, int pnLIMIT, int pnSORT, int pnDIRECTION, String pvLOGIN) throws SQLException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_C150F, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFB050),
                    new Param(OracleTypes.CHAR, pvSTATUS),
                    new Param(OracleTypes.CHAR, pvUSER),
                    new Param(OracleTypes.INTEGER, pnDAYS),
                    new Param(OracleTypes.INTEGER, pnOFFSET),
                    new Param(OracleTypes.INTEGER, pnLIMIT),
                    new Param(OracleTypes.INTEGER, pnSORT),
                    new Param(OracleTypes.INTEGER, pnDIRECTION),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.find(dataStatement, C150.class);
        } catch (InstantiationException ex) {
            Logger.getLogger(C150Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(C150Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    //
    public List<C150> listC150(int pnFH000, int pnFH200, String pvBV051, String pvLogin) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_C150, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvBV051),
                    new Param(OracleTypes.CHAR, pvLogin)
                });
        return super.find(dataStatement, C150.class);
    }

    public int deleteC150(int pnPB050, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.DELETE_C150, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPB050),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return update(dataStatement, C150.class);
    }

    public int update_C150(String pvPC150,
            int pnFH000,
            int pnFH200L,
            int pnFH200S,
            int pnFH150,
            int pnFS200,
            int pnFC400,
            int pnFC450,
            String pvFC550,
            int pnFC500,
            int pnFN600,
            String pvCV151,
            Date pdCD152,
            Date pdCD153,
            String pvCV154,
            Date pdCD155,
            Date pdCD156,
            String pvCV157,
            String pvCV158,
            Date pdCD159,
            Date pdCD160,
            String pvCV161,
            String pvCV162,
            String pvCV163,
            String pvCV164,
            String pvCV165,
            String pvCV166,
            int pnCN168,
            int pnCN169,
            int pnCN170,
            int pnCN171,
            int pnCN172,
            String plCB173,
            int pnFC000,
            String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_C150, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.CHAR, pvPC150),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200L),
                        new Param(OracleTypes.INTEGER, pnFH200S),
                        new Param(OracleTypes.INTEGER, pnFH150),
                        new Param(OracleTypes.INTEGER, pnFS200),
                        new Param(OracleTypes.INTEGER, pnFC400),
                        new Param(OracleTypes.INTEGER, pnFC450),
                        new Param(OracleTypes.CHAR, pvFC550),
                        new Param(OracleTypes.INTEGER, pnFC500),
                        new Param(OracleTypes.INTEGER, pnFN600),
                        new Param(OracleTypes.CHAR, pvCV151),
                        new Param(OracleTypes.DATE, pdCD152),
                        new Param(OracleTypes.DATE, pdCD153),
                        new Param(OracleTypes.CHAR, pvCV154),
                        new Param(OracleTypes.DATE, pdCD155),
                        new Param(OracleTypes.DATE, pdCD156),
                        new Param(OracleTypes.CHAR, pvCV157),
                        new Param(OracleTypes.CHAR, pvCV158),
                        new Param(OracleTypes.DATE, pdCD159),
                        new Param(OracleTypes.DATE, pdCD160),
                        new Param(OracleTypes.CHAR, pvCV161),
                        new Param(OracleTypes.CHAR, pvCV162),
                        new Param(OracleTypes.CHAR, pvCV163),
                        new Param(OracleTypes.CHAR, pvCV164),
                        new Param(OracleTypes.CHAR, pvCV165),
                        new Param(OracleTypes.CHAR, pvCV166),
                        new Param(OracleTypes.INTEGER, pnCN168),
                        new Param(OracleTypes.INTEGER, pnCN169),
                        new Param(OracleTypes.INTEGER, pnCN170),
                        new Param(OracleTypes.INTEGER, pnCN171),
                        new Param(OracleTypes.INTEGER, pnCN172),
                        new Param(OracleTypes.CLOB, plCB173),
                        new Param(OracleTypes.INTEGER, pnFC000),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, C150.class);
        } catch (SQLException ex) {
            Logger.getLogger(C150Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }
    }

    public int StornoTab150(String pvFC150, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_150, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.CHAR, pvFC150),
                        new Param(OracleTypes.CHAR, pvLOGIN)});

            return super.update(dataStatement, C150.class);
        } catch (SQLException ex) {
            Logger.getLogger(C150Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }
    }

    public int updateC150(
            int pnPB050, int pnFH000, int pnFH200, int pnFS200,
            int pnFH075, int pnFH150, String pvBV051, String pvBV052,
            Date pdBD053, String pvBV054, int pnBN055, int pnBN056,
            int pnBN057, int pnBN058, int pnBN059, String pvBV060,
            int pnBN061, int pnBN062, String pvLOGIN) throws SQLException {
        DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_C150, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPB050),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFS200),
                    new Param(OracleTypes.INTEGER, pnFH075),
                    new Param(OracleTypes.INTEGER, pnFH150),
                    new Param(OracleTypes.CHAR, pvBV051),
                    new Param(OracleTypes.CHAR, pvBV052),
                    new Param(OracleTypes.DATE, pdBD053),
                    new Param(OracleTypes.CHAR, pvBV054),
                    new Param(OracleTypes.INTEGER, pnBN055),
                    new Param(OracleTypes.INTEGER, pnBN056),
                    new Param(OracleTypes.INTEGER, pnBN057),
                    new Param(OracleTypes.INTEGER, pnBN058),
                    new Param(OracleTypes.INTEGER, pnBN059),
                    new Param(OracleTypes.CHAR, pvBV060),
                    new Param(OracleTypes.INTEGER, pnBN061),
                    new Param(OracleTypes.INTEGER, pnBN062),
                    new Param(OracleTypes.CHAR, pvLOGIN)});
        return super.update(updateStatement, null);
    }
}
